CROSS_COMPILE = riscv-none-embed-
CC = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump

OBJECTS = rom.o

export CROSS_COMPILE

all: rom.data

%.o: %.S
	$(CC) $< -o $@

rom.elf: ram.ld $(OBJECTS)
	$(LD) -T ram.ld $(OBJECTS) -o $@

rom.bin: rom.elf
	$(OBJCOPY) -O binary $< $@

rom.data: rom.bin
	python3 ../tools/Bin2mem.py rom.bin rom.data
	cp rom.data ../sim

clean:
	rm -f *.o *.elf *.bin *.data ../sim/*.data
